using System;
using System.Collections.Generic;
using System.Text;
using Barrage.Global;

namespace Barrage.Shaders
{
    /// <summary>
    /// Singleton instance of D3DShader that loads the "gui.fx" shader
    /// </summary>
    public class GuiShader : D3DShader
    {
        static GuiShader instance = null;

        /// <summary>
        /// Gets the GUI shader, creating it if necessary
        /// </summary>
        public static GuiShader Instance { get { if (instance == null) instance = new GuiShader(); return instance; } }

        GuiShader()
            : base("gui.fx")
        {
            Engine.RegisterDisposeHandler(new EngineDisposeHandler(Dispose));
        }

        /// <summary>
        /// \internal Clear resources
        /// </summary>
        public override void Dispose()
        {
            instance = null;
            base.Dispose();
        }

    }
}
